public bool Apply(string name, int storeId) { var partner = new PartnerDTO(); var user = _user.GetByName(name).Result; var store = _store.FindByID(storeId); partner.ModifiedDate = DateTime.Now; partner.UseID = user.ID; partner.StoreID = storeId; partner.CreatedDate = DateTime.Now; partner.isWorking = false; if (_repo.Apply(partner.Translate <PartnerDTO, Partner>()) != null) { var mess = new Message(); mess.CreatedDate = DateTime.Now; mess.DataID = storeId; mess.Description = user.UserName + " just applied to your store " + store.Name; mess.IsRead = false; mess.MessageType = MESS_PARTNER; mess.SentID = store.UserID; mess.FromID = user.ID; _mess.CreateMessage(mess); return(true); } return(false); }