// M e t h o d s - C R U D // C r e a t e public DailyRoutine Create(DailyRoutine dailyRoutine) { try { context.DailyRoutines.Add(dailyRoutine); context.SaveChanges(); return(dailyRoutine); } catch (Exception e) {//something bad happened! return(null); } }
// M e t h o d s - C R U D // C r e a t e public VetVisit Create(VetVisit vetVisit) { try { context.VetVisits.Add(vetVisit); context.SaveChanges(); return(vetVisit); } catch (Exception e) {//something bad happened! return(null); } }
// M e t h o d s - C R U D // C r e a t e public Walk Create(Walk walk) { try { context.Walks.Add(walk); context.SaveChanges(); return(walk); } catch (Exception e) {//something bad happened! return(null); } }
// M e t h o d s - C R U D // C r e a t e public Dog Create(Dog dog) { var user = signinManager.Context.User; bool isLoggedIn = user.Identity.IsAuthenticated; if (isLoggedIn) { string userName = user.Identity.Name; dog.UserName = userName; try { context.Dogs.Add(dog); context.SaveChanges(); return(dog); } catch (Exception e) {//something bad happened! } } return(null); }