BAL.Manager.CarManager.GiveAwayCar C# (CSharp) Method

GiveAwayCar() public method

Manager method that is used to set specific car objects UserId property, used to determine who is currently using specific car.
public GiveAwayCar ( int CarId, int NewCarUserId ) : string
CarId int Input parameter that represents car object`s id.
NewCarUserId int Input paramenter that represents new car object`s id.
return string
        public string GiveAwayCar(int CarId, int NewCarUserId)
        {
            if (CarId <= 0 || NewCarUserId <= 0)
            {
                return "Error";
            }
            var GiveAwayCar = uOW.CarRepo.Get(s => s.Id == CarId).FirstOrDefault();
            if (GiveAwayCar == null)
            {
                return "Error";
            }
            uOW.CarRepo.SetStateModified(GiveAwayCar);
            GiveAwayCar.UserId = NewCarUserId;
            GiveAwayCar.isMain = false;
            uOW.Save();
            return "Success";
        }